<script setup lang="ts">
const empty: Provider = {
  id: "",
  name: "",
  notify_days: 0,
  renew_days: 0,
};
const emit = defineEmits<{
  (e: "submit", provider: Provider): void;
}>();
const props = defineProps<{ provider?: Provider }>();
const state = reactive(props.provider ?? empty);

const handleSubmit = () => {
  emit("submit", state);
};
</script>

<template>
  <Form @submit="handleSubmit">
    <FormInput label="名称" v-model="state.name" required />
    <FormInput label="续期天数" v-model.number="state.renew_days" required />
    <FormInput label="提醒天数" v-model.number="state.notify_days" required />
  </Form>
</template>
